package svgedit.gui.commands;


import svgedit.svg.SVGElement;

/**
 * Handles undoing and redoing deletions
 * @author SARJ
 *
 */
public class DeleteCommand implements Command
{

	SVGElement[] elements;
	
	/**
	 * Constructs the command and prepares it for document deletion
	 * @param elements The array list of elements to delete
	 */
	public DeleteCommand(SVGElement[] elements)
	{	
		this.elements = elements;		
	}

	@Override
	public void executeUndo()
	{
		for (SVGElement elem : elements)
			elem.getParent().appendChild(elem);
		
	}

	@Override
	public void executeRedo()
	{
		for (SVGElement elem : elements)		
			elem.getParent().removeChild(elem);		
	}
}
